package com.vastcom.tyauthcenter.dao;


import com.vastcom.tyauthcenter.model.Dept;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface DeptDao extends JpaRepository<Dept,String> {

    @Query("select d from Dept d where d.pid=:pid order by d.sort asc")
    List<Dept> getDeptsByPid(@Param("pid") String pid);

    @Query("select d from Dept d where d.pid is null order by d.sort asc ")
    List<Dept> getRootDept();

}
